<!-- S search -->
<app-search-bar
  [submitLoading]="tableParams.loading"
  [searchOptions]="searchOptions"
  labelFlex="80px"
  (onSearch)="queryResetData($event)"
  (onReset)="queryResetData($event)"
>
</app-search-bar>
<!-- E search -->

<nz-card class="m-t-2">
  <div class="opera-wrap">
    <button
      nz-button
      nzType="primary"
      [nzLoading]="exportLoading"
      (click)="exportTableData()">
      <i nz-icon nzType="download" nzTheme="outline"></i>
      导出
    </button>
  </div>

  <div class="pagination-wrap-position p-t-10">
    <nz-table
      #basicTable
      nzSize="small"
      nzShowSizeChanger
      nzShowQuickJumper
      nzOuterBordered
      [nzScroll]="{ x: '1100px' }"
      [nzFrontPagination]="false"
      [nzLoadingDelay]="100"
      [nzLoading]="tableParams.loading"
      [nzData]="tableParams.tableData"
      [nzPageSizeOptions]="[5, 10, 20, 50, 100]"
      [nzTotal]="tableParams.total"
      [nzPageIndex]="tableParams.page"
      [nzPageSize]="tableParams.pageSize"
      [nzShowTotal]="totalTemplate"
      (nzPageIndexChange)="onPageIndexChange($event)"
      (nzPageSizeChange)="onPageSizeChange($event)"
    >
      <thead>
        <tr>
          <th nzAlign="center" nzLeft>出库单号</th>
          <th nzAlign="center">出库状态</th>
          <th nzAlign="center">出库类型</th>
          <th nzAlign="center">新建时间</th>
          <th nzAlign="center">出库时间</th>
          <th nzAlign="center">机器编码</th>
          <th nzAlign="center">SN</th>
          <th nzAlign="center">IMEI</th>
          <th nzAlign="center">出库实际金额</th>
          <th nzAlign="center">关联单号</th>
          <th nzAlign="center">原编码</th>
        </tr>
      </thead>

      <tbody>
        <tr *ngFor="let data of basicTable.data; let index = index;">
          <!-- 机器编码 -->
          <td nzAlign="center" nzLeft>{{ data.deliveryNumber || '-' }}</td>
          <!-- 出库状态 -->
          <td nzAlign="center">
            <span [ngStyle]="{'color': data.state | secondOutStatus: 'color'}">
              {{ data.state | secondOutStatus: 'label' }}
            </span>
          </td>
          <!-- 出库类型 -->
          <td nzAlign="center">
            <span>
              {{ filterText(outTypeOptions, data.type, 'content', 'name') }}
            </span>
          </td>
          <!-- 新建时间 -->
          <td nzAlign="center">{{ data.createTime || '-' }}</td>
          <!-- 出库时间 -->
          <td nzAlign="center">{{ data.deliveryTime || '-' }}</td>
          <!-- 机器编码 -->
          <td nzAlign="center">{{ data.equipmentCode || '-' }}</td>
          <!-- SN -->
          <td nzAlign="center">{{ data.serialNumber || '-' }}</td>
          <!-- IMEI -->
          <td nzAlign="center">{{ data.imei || '-' }}</td>
          <!-- 出库实际金额 -->
          <td nzAlign="center">{{ data.sumPrice || '-' }}</td>
          <!-- 关联单号 -->
          <td nzAlign="center">{{ data.orderNum || '-' }}</td>
          <!-- 原编码 -->
          <td nzAlign="center">{{ data.oldEquipmentCode || '-' }}</td>
        </tr>
      </tbody>
    </nz-table>

    <!-- 分页template -->
    <ng-template #totalTemplate let-total>共有 {{ total }} 条</ng-template>
  </div>
</nz-card>